﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test02
{
    class Program
    {
        //2.用方法实现：将上题的交换操作封装成一个方法，方法有两个参数n1,n2，在方法中将n1和n2交换（提示：ref）。
        public void Sweep(ref int a,ref int b)
        {
            int tmp;
            tmp = a;
            a = b;
            b = tmp;
        }
        static void Main(string[] args)
        {
            Program n = new Program();
            int n1 = 10, n2 = 20;
            n.Sweep(ref n1, ref n2);
            Console.WriteLine("n1={0},n2={1}", n1, n2);
            Console.ReadKey();
        }
    }
}
